home *** CD-ROM | disk | FTP | other *** search
- Path: nntp1.best.com!donstarr
- From: super@donstarr.org (Don Starr)
- Newsgroups: comp.lang.c++
- Subject: Re: Array pointer?
- Date: Thu, 18 Apr 96 04:08:03 GMT
- Organization: Best Internet Communications
- Message-ID: <4l4f73$1a8_004@donstarr.best.com>
- References: <DppIHL.MzF@on.bell.ca> <829513366snz@j-bg.demon.co.uk>
- NNTP-Posting-Host: donstarr.vip.best.com
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <829513366snz@j-bg.demon.co.uk>,
- John Sargent <jb@j-bg.demon.co.uk> wrote:
- *
- * [OK stuff clipped]
- *
- *> ; is this correct, too?
- *> int *c3
- *>
- *> c3 = (a + 3 * sizeof(int) );
- *> count << *c3;
- *>
- *
- * OK. you'll get the contents of a[3]
-
- No, you'll get the contents of a[ 3 * sizeof(int) ]. The compiler will handle
- the sizeof when it does the pointer arithmetic.
-
- * a + 3 is the same as a + (3 * sizeof(int)) if a is an int *
-
- This statement seems to contradict the one above it that says "OK. you'll get
- the contents of a[3]".
-
- Don
-